package com.javaAPI.demo12;

import java.util.Calendar;

public class Test {
    public static void main(String[] args) {

        Calendar c = Calendar.getInstance();//多态
        System.out.println(c);
        int i = c.get(Calendar.YEAR);//获取年份
        int j = c.get(Calendar.MONTH) + 1;//获取月   从0开始，需要加1
        int k = c.get(Calendar.DATE);//获取日
        System.out.println("年:" + i + "月" + j + "日" + k);
    }
}
